
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Edit Place</title>

        <link rel="stylesheet" href="css/gmaps/default.css" type="text/css" />
        <link rel="stylesheet" href="css/token/token-input.css" type="text/css" />
        <link rel="stylesheet" href="css/token/token-input-facebook-2.css" type="text/css" />
        <link rel="stylesheet" href="css/jquery/jquery-ui.css" type="text/css" />

        <style>
            a {color:#404042;text-decoration:none;}      /* unvisited link */
            a:visited {color:#404042;}  /* visited link */
            a:hover {color:#404042;}  /* mouse over link */
            a:active {color:#404042;}  /* selected link */
        </style>

        <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&libraries=places"></script>
        <script type="text/javascript" src="js/jquery/jquery-1.9.1.min.js"></script>
        <script type="text/javascript" src="js/jquery/jquery-1.10.3-ui.min.js"></script> 
        <script type="text/javascript" src="js/token/jquery.tokeninput.js"></script>    

        <%@ include file="include/placeEditMaps.jsp" %>
        <%@ include file="include/placeTokenizerUtils.jsp" %>
        <%@ include file="include/placeedit_incl.jsp" %>     

        <script type="text/javascript">
            function runGeocode() {
                showAddress($("#addr").val(), "lat", "lng");
            }
        </script>
        
        <script type="text/javascript">
            $(function() {
                try {
                    initialize();
                }
                catch (e) {
                    alert(e)
                }
            });
        </script>  
        
    </head>


    <body style="text-align: center; background-color: #FAFAFA; color: #404042; font-family: Century Gothic, Calibri, Verdana; padding: 0px; margin: 0px;">                

        <div style="margin-top: 0px; background-color: white;">

            <%@include file="header.jsp" %>

            <div style="width: 100%; text-align: left; font-family: Century Gothic, Calibri, Verdana; color: #404042; background-color: white; background: url('${model.props.appPath}/img/content-bg-short.jpg'); background-repeat: repeat-x; display: block; position: relative; top: -2px;">

                <div style="width: 1020px; margin-top: 10px; margin: 0 auto;">

                    <br>
                    <h1>&nbsp;Edit Place (id: ${model.place.id})</h1>

                    <form action="place.htm" method="post" >
                        <table cellpadding="5" cellspacing="5">
                            <tr>
                                <td>Title:</td>
                                <td><input type="text" name="title" style="width:800px; padding: 5px;" value="${model.place.title}"/></td>
                            </tr>
                            <tr>
                                <td style="vertical-align: top;">Description:</td>
                                <td><textarea name="description" style="width:800px; height: 200px;padding: 5px;">${model.place.description}</textarea></td>
                            </tr>
                            <tr>
                                <td>Short Description:</td>
                                <td><input type="text" name="shortDescription" style="width:800px; padding: 5px;" value="${model.place.shortDescription}"/></td>
                            </tr>
                            <tr>
                                <td>Place Type:</td>
                                <td>
                                    <select name="placeTypeID" style="padding: 3px;">                            
                                        <c:choose>
                                            <c:when test="${model.place.placeTypeID == 1}">
                                                <option value="1" selected="selected">Country</option>                               
                                            </c:when>
                                            <c:otherwise>
                                                <option value="1">Country</option>                              
                                            </c:otherwise>
                                        </c:choose>  

                                        <c:choose>
                                            <c:when test="${model.place.placeTypeID == 2}">
                                                <option value="2" selected="selected">Region</option>                             
                                            </c:when>
                                            <c:otherwise>
                                                <option value="2">Region</option>                            
                                            </c:otherwise>
                                        </c:choose>  

                                        <c:choose>
                                            <c:when test="${model.place.placeTypeID == 3}">
                                                <option value="3" selected="selected">City</option>                              
                                            </c:when>
                                            <c:otherwise>
                                                <option value="3">City</option>                              
                                            </c:otherwise>
                                        </c:choose>  
                                        <c:choose>
                                            <c:when test="${model.place.placeTypeID == 4}">
                                                <option value="4" selected="selected">District</option>                           
                                            </c:when>
                                            <c:otherwise>
                                                <option value="4">District</option>                            
                                            </c:otherwise>
                                        </c:choose>  
                                        <c:choose>
                                            <c:when test="${model.place.placeTypeID == 5}">
                                                <option value="5" selected="selected">Building</option>                              
                                            </c:when>
                                            <c:otherwise>
                                                <option value="5">Building</option>                           
                                            </c:otherwise>
                                        </c:choose>  
                                        <c:choose>
                                            <c:when test="${model.place.placeTypeID == 6}">
                                                <option value="6" selected="selected">Village</option>                             
                                            </c:when>
                                            <c:otherwise>
                                                <option value="6">Village</option>                            
                                            </c:otherwise>
                                        </c:choose>                              
                                    </select>
                                </td>
                            </tr>     
                            
                            <tr>
                                <td>Street:</td>
                                <td>
                                    <input id="place-street" type="text" name="street" style="width:200px; padding: 5px;" value="${model.place.street}"/>
                                </td>
                            </tr>
                            <tr>
                                <td>City:</td>
                                <td>
                                    <select id="place-city" name="city" style="width:200px; padding: 5px;">
                                        <option value="" selected>N/A</option>
                                        <option value="Makati">Makati</option>
                                        <option value="Taguig" style="font-size: 16px; padding: 1px;">Taguig</option>
                                        <option value="Mandaluyong" style="font-size: 16px; padding: 1px;">Mandaluyong</option>
                                        <option value="Pasig" style="font-size: 16px; padding: 1px;">Pasig</option>
                                        <option value="Quezon City" style="font-size: 16px; padding: 1px;">Quezon City</option>
                                        <option value="Manila" style="font-size: 16px; padding: 1px;">Manila</option>
                                        <option value="Pasay" style="font-size: 16px; padding: 1px;">Pasay</option>
                                        <option value="Paranaque" style="font-size: 16px; padding: 1px;">Paranaque</option>
                                        <option value="Muntinlupa" style="font-size: 16px; padding: 1px;">Muntinlupa</option>
                                        <option value="San Juan" style="font-size: 16px; padding: 1px;">San Juan</option>
                                        <option value="Cebu" style="font-size: 16px; padding: 1px;">Cebu</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>Zip:</td>
                                <td>
                                    <select id="place-zip" name="zip" style="width:200px; padding: 5px;">
                                        <option value="0000" selected>-- Choose one --</option>
                                        <option value="1200">1200 (Makati Central Post Office)</option>
                                        <option value="1203">1203 (San Antonio Village)</option>
                                        <option value="1204">1204 (La Paz, Singkamas, and Tejeros)</option>
                                        <option value="1205">1205 (Santa Cruz)</option>
                                        <option value="1206">1206 (Kasilawan)</option>
                                        <option value="1207">1207 (Carmona and Olympia)</option>
                                        <option value="1208">1208 (Valenzuela)</option>
                                        <option value="1209">1209 (Bel-Air)</option>
                                        <option value="1210">1210 (Poblacion)</option>
                                        <option value="1211">1211 (Guadalupe Viejo)</option>
                                        <option value="1212">1212 (Guadalupe Nuevo)</option>
                                        <option value="1213">1213 (Pinagkaisahan - Pitogo)</option>
                                        <option value="1214">1214 (Cembo)</option>
                                        <option value="1215">1215 (West Rembo)</option>
                                        <option value="1216">1216 (East Rembo and Malapad na Bato)</option>
                                        <option value="1217">1217 (Comembo)</option>
                                        <option value="1218">1218 (Pembo)</option>
                                        <option value="1219">1219 (Forbes Park North)</option>
                                        <option value="1220">1220 (Forbes Park South)</option>
                                        <option value="1221">1221 (Dasmariñas Village North)</option>
                                        <option value="1222">1222 (Dasmariñas Village South)</option>
                                        <option value="1223">1223 (San Lorenzo Village)</option>
                                        <option value="1224">1224 (Makati Commercial Center [Ayala Center])</option>
                                        <option value="1225">1225 (Urdaneta Village)</option>
                                        <option value="1226">1226 (Ayala Avenue-Paseo de Roxas)</option>
                                        <option value="1227">1227 (Salcedo Village)</option>
                                        <option value="1228">1228 (Greenbelt)</option>
                                        <option value="1229">1229 (Legaspi Village)</option>
                                        <option value="1230">1230 (Pio del Pilar)</option>
                                        <option value="1231">1231 (Pasong Tamo and Ecology Village)</option>
                                        <option value="1232">1232 (Magallanes Village)</option>
                                        <option value="1233">1233 (Bangkal)</option>
                                        <option value="1234">1234 (San Isidro)</option>
                                        <option value="1235">1235 (Palanan)</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>Region:</td>
                                <td>
                                    <select id="place-region" name="region" style="width:200px; padding: 5px;">
                                        <option value="" selected>--- Pick One ---</option>
                                        <option value="Metro Manila">Metro Manila</option>
                                        <option value="Central Visayas">Central Visayas</option>
                                        <option value="Davao Region">Davao Region</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>Country:</td>
                                <td>
                                    <select id="place-country" name="country" style="width:200px; padding: 5px;">
                                        <option value="Philippines" selected>Philippines</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>Lat:</td>
                                <td><input id="lat" type="text" name="lat" style="width:200px; padding: 3px;" value="${model.place.lat}"/></td>
                            </tr>
                            <tr>
                                <td>Lng:</td>
                                <td><input id="lng" type="text" name="lng" style="width:200px; padding: 3px;" value="${model.place.lng}"/></td>
                            </tr>                             
                            <tr>
                                <td>Wiki URL:</td>
                                <td><input id="wikiURL" type="text" name="wikiURL" style="width:200px; padding: 3px;" value="${model.place.wikiURL}"/></td>
                            </tr> 
                            <tr>
                                <td>FourSQ Venue ID:</td>
                                <td><input id="foursqVenueID" type="text" name="foursqVenueID" style="width:200px; padding: 3px;" value="${model.place.foursqVenueID}"/></td>
                            </tr>
                            <tr>
                                <td>

                                </td>
                                <td>
                                    <div id="map_canvas" style="width:800px; height:300px; position:relative; left:0%"></div>
                                </td>
                            </tr> 
                            
                            <tr>
                                <td>Cities:</td>
                                <td><input id="tags-cities" name="cityIDs" type="text" /></td>
                            </tr>
                            <tr>
                                <td>Districts:</td>
                                <td><input id="tags-districts" name="districtIDs" type="text" /></td>
                            </tr>
                            <tr>
                                <td>Buildings:</td>
                                <td><input id="tags-buildings" name="buildingIDs" type="text" /></td>
                            </tr>
                            <tr>
                                <td>Villages</td>
                                <td><input id="tags-villages" name="villageIDs" type="text" /></td>
                            </tr>
                            <tr>
                                <td></td>
                                <td>
                                    <input type="submit" value="Submit" />
                                    <input type="hidden" name="id" value="${model.place.id}" />
                                    <input type="hidden" name="a" value="4" />
                                    <input type="hidden" name="s" value="1" />
                                </td>
                            </tr>
                        </table>
                    </form>
                    <br><br>

                </div>

                <br><br>                

            </div>

            <div>
                <img src="${model.props.appPath}/img/footer-foot.jpg" style="border: 0px solid black; display: block; width: 100%;" />
            </div>

        </div>

    </body>

</html>
